package com.example.netty.udp.classloader;

import sun.misc.Resource;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;


public class DiskClassLoader extends URLClassLoader {

    private String path;

    public DiskClassLoader(String path) {
        super(pathToUrl(path));
        this.path = path;
    }

    private static URL[] pathToUrl(String path) {
        try {
            return new URL[]{new File(path).toURI().toURL()};
        } catch (Exception e) {
            return null;
        }
    }

}
